<template>
  <div class="root">
    <div class="right"></div>
    <div class="rightm">成后勤管理系统</div>
    <div class="left">
      <el-dropdown trigger="click" @command="choose">
        <div class="name" style="font-size: 16px; cursor: pointer">
          <span>{{ $store.state.user.userInfo.name }}</span>
          <i class="iconfont icon-xiala1"></i>
        </div>
        <template #dropdown>
          <el-dropdown-menu>
            <el-dropdown-item :command="1">个人中心</el-dropdown-item>
          </el-dropdown-menu>
          <el-dropdown-menu>
            <el-dropdown-item :command="0">退出登录</el-dropdown-item>
          </el-dropdown-menu>
        </template>
      </el-dropdown>
    </div>
  </div>
</template>

<script setup>
import { useStore } from "vuex";
const $store = useStore();
import { useRouter } from "vue-router";
let $Router = useRouter();
let choose = (e) => {
  if (e == 0) {
    $Router.push("/login");
    $store.commit("user/changeisLogin");
  }
};
</script>

<style lang="scss" scoped>
.root {
  box-sizing: border-box;
  height: 80px;
  width: 100%;
  background-color: #409eff;
  display: flex;
  justify-content: space-between;
}
.right {
  height: 80px;
  width: 200px;

  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.rightm {
  height: 80px;

  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 35px;
  font-weight: 600;
  font-style: italic;
}
.left {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  height: 80px;
  padding-right: 150px;
}
</style>
